<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>好友申请(7天内)</title>
    <link rel="stylesheet" href="${base}/layui/css/layui.css">
    <link rel="stylesheet" href="${base}/awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${base}/css/admin.css">
    <style>
    	.layui-bg-black{        width: 200px;height: 136px;margin-right: 30px;float: left;text-align: center;font-size: 33px;color: #000000!important;padding-top: 30px;}
    	.checkbox{display: inline-block;}
    	.layui-form-item{font-size: 18px;}
    	.width100 {width: 100px; margin-right: 30px;float: left;}
    </style>
    <script src="${base}/js/jquery-2.1.4.min.js" type="text/javascript"></script>
	<script src="${base}/layui/layui.all.js"></script>
	<script type="text/javascript">
	function _reply(_id,_status){
		$.post("${base}/navy_user/friend_status",
		   		{"hello_id":_id,"status":_status},function(data){ 
		   			layer.alert(data);
		   			window.location.reload();
		   		}
		 );	
	}
	</script>
</head>
<body  class="layui-layout-body" style="overflow:scroll;">
<#include "/common/left.flt">	
<div class="layui-main" style="position: absolute;left: 205px;top: 20px; width: calc(100% - 210px);" >
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
  <legend>操作提示</legend>
</fieldset>
<blockquote class="layui-elem-quote layui-quote-nm">
	<form action="${base}/navy_user/friend_app" method="post" id="dataForm" >
        <input type="hidden" id="page" name="page" value="1"/>

        <div class="layui-input-inline" >
        	<label class="layui-form-label">地区负责人</label><select name="person" id="person" class="width100 layui-select">
 				<option value=""></option>
 				<option value="1">袁杰</option>
                <option value="2">李扬</option>
                <option value="3">张炜</option>
                <option value="4">常少彪</option>
                <option value="100">强制清空</option>
		      </select>
		      <label class="layui-form-label">VIP类型</label><select name="vip_badpe" id="vip_badpe" class="width100 layui-select">
 				<option value="0">无会员</option>
 				<option value="1">月度会员</option>
                <option value="2">季度会员</option>
                <option value="3">年度会员</option>
                <option value="4">终身会员</option>
		      </select>
		      <label class="layui-form-label">被申请的用户类型</label><select name="is_true" id="is_true" class="width100 layui-select">
		        <option value=''>不限</option>
				<option value='2'>B类</option>
				<option value='3'>C类</option>
				<option value='4'>D类</option>
		      </select>
		      <button class="layui-btn" lay-submit=""> <span class="fa fa-search"></span> 查询</button>
 		</div>
    </form>
	<div class="layui-form" style="display: inline-block;">
	    <div class="layui-input-block">
	      <a class="layui-btn" onclick="_reply(1);" >同意</a> <a class="layui-btn" onclick="_reply(-1);" >拒绝</a>  <a class="layui-btn" onclick="_reply(0);" title="仅后台不出现" >忽略</a>
		</div>
	</div>
</blockquote> 
<table class="layui-table" >
	<thead>
        <tr>
              <th>内容</th>
              <th>主动省份</th>
              <th>被动user_id</th>
              <th>申请人省份</th>
              <th>性别</th>
              <th>生日</th>
             	<th><input type="checkbox" id="all" />主动user_id</th>
             	<th>带热度</th>
              <th>打招呼时间</th>
              <th>VIP类型</th>
              <th>VIP到期时间</th>
              <th>相关参数</th>
          </tr>
     </thead>
     <tbody>
     <#list list as one>
     <tr>
     	<td><script>document.write(decodeURIComponent("${one.content?default('')}"));</script></td>
     	<td>${one.user_id_area?default('')}</td>
     	<td><a href="${base}/users_list/detail?user_id=${one.target_user_id}" target="_blank">${one.target_user_id?default('')}<script>document.write(decodeURIComponent("${one.nick_name2?default('')}"));</script></a></td>
     	<td>${one.target_user_id_area?default('')}</td>
     	<td>${one.target_user_id_sex_name?default('')}</td>
     	<td>${one.birthday_string?default('')}</td>
     	<td><input type="checkbox" name="id" value="${one.id}" /><a href="${base}/users_list/detail?user_id=${one.user_id}" target="_blank" >${one.user_id?default('')}<script>document.write(decodeURIComponent("${one.nick_name?default('')}"));</script></a></td>
     	<td>${one.hot?default('0')}<a onclick="pass_one(${one.id});" class="layui-btn layui-btn-sm layui-btn-danger" title="过1个,其他忽略">过1个</a></td>
     	<td>${one.create_time_string?default('')}</td>
     	<td>${one.vip_type?default('无')}</td>
     	<td>${one.vip_end_time_string?default('')}</td>
     	<td id="hot${one.id}"><a onclick="params(${one.id});">点击查看</a></td>
     </tr>
     </#list>
     </tbody>
</table>
<div id="pageDiv"></div>
</body>
<script src="${base}/laydate/laydate.js"></script>
<script type="text/javascript">
$("#person").val('${person?default('')}');
$("#vip_badpe").val('${vip_badpe?default('')}');
$("#is_true").val('${is_true?default('')}');
function params(id){
	$.get("${base}/navy_user/friend_app_hot?id="+id, function(result){
		 $("#hot"+id).html(result);
	  });
}

function pass_one(id){
	$.get("${base}/navy_user/friend_pass_one?hello_id="+id, function(result){
		layer.msg(result);
	  });
}


layui.use('laypage',function () {
    var laypage = layui.laypage ;
    laypage.render({
        elem:"pageDiv",
        count:${page.totalPage*20},
        limit:20,
        curr:${page.pageNumber},
        layout:['count','prev','page','next','skip'],
        jump:function (obj,first) {
            var page = obj.curr;
            if(!first){
                $("#page").val(page);
                $("#dataForm").submit();
            }
        }
    });
});

$("#all").click(function (){
	if ($("#all").prop("checked")) {
		$("input[type='checkbox']").prop("checked", true);
	} else {
		$("input[type='checkbox']").prop("checked", false);
	}
});
function _reply(status){
	 try {
		var ids = "";
		$('input[name="id"]:checked').each(function(){//遍历每一个名字为interest的复选框，其中选中的执行函数    
			ids = ids + $(this).attr("value")+",";
	    });
		if(ids){
			$.post("${base}/navy_user/friend_status_select",
			   		{"ids":ids,"status":status},function(data){ 
			   			layer.msg(data);
			   		}
			    );
		}
     }catch(e) {
        console.log(e)
     }
}
</script>
</html>